/**
 * Copyright (C) T-Systems International, 2013-2014
 * <p/>
 * The copyright of the computer program herein is the property of
 * T-Systems International. The program may be used and/or copied
 * only with the written permission of T-Systems International or in
 * accordance with the terms and conditions stipulated in the
 * agreement/contract under which the program has been supplied.
 * <p/>
 * $Author: kuzin43 $
 * $Date: 2014-10-16 13:27:35 +0000 (Thu, 16 Oct 2014) $
 * $Rev: 84 $
 */
package com.tsystems.bsipp.dm.persistence.model;

import com.tsystems.bsipp.dm.persistence.enumeration.ConnectionAreaStatusValue;
import com.tsystems.bsipp.dm.persistence.enumeration.PackageLevelStatusValue;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

import static com.tsystems.bsipp.dm.persistence.model.ModelConstants.STRING_LENGTH;
import static com.tsystems.bsipp.dm.persistence.model.ModelConstants.STRING_LENGTH_5;

@Entity
public class ConnectionArea extends AbstractEntity {

    @ManyToOne
    @JoinColumn(name = "kontes_region_id", referencedColumnName = "id", nullable = false)
    private KontesRegion kontesRegion;

    @Column(length = STRING_LENGTH_5)
    private String localAreaCode;

    @Column(length = STRING_LENGTH_5)
    private String connectionArea;

    @Temporal(TemporalType.TIMESTAMP)
    private Date plannedChangeStartDate;

    @Temporal(TemporalType.TIMESTAMP)
    private Date plannedChangeEndDate;

    @Temporal(TemporalType.TIMESTAMP)
    private Date committeeApprovalDate;

    @Column
    private int freePorts;

    @Enumerated(EnumType.STRING)
    @Column(length = STRING_LENGTH)
    private ConnectionAreaStatusValue connectionAreaStatusValue;

    @Enumerated(EnumType.STRING)
    @Column(length = STRING_LENGTH)
    private PackageLevelStatusValue packageLevelStatusValue;

    @OneToMany(mappedBy = "connectionArea", cascade = CascadeType.ALL, fetch = FetchType.LAZY, orphanRemoval = true)
    private List<Line> lines;

    public String getLocalAreaCode() {
        return localAreaCode;
    }

    public void setLocalAreaCode(String localAreaCode) {
        this.localAreaCode = localAreaCode;
    }

    public String getConnectionArea() {
        return connectionArea;
    }

    public void setConnectionArea(String connectionArea) {
        this.connectionArea = connectionArea;
    }

    public Date getPlannedChangeStartDate() {
        return plannedChangeStartDate;
    }

    public void setPlannedChangeStartDate(Date plannedChangeStartDate) {
        this.plannedChangeStartDate = plannedChangeStartDate;
    }

    public Date getPlannedChangeEndDate() {
        return plannedChangeEndDate;
    }

    public void setPlannedChangeEndDate(Date plannedChangeEndDate) {
        this.plannedChangeEndDate = plannedChangeEndDate;
    }

    public Date getCommitteeApprovalDate() {
        return committeeApprovalDate;
    }

    public void setCommitteeApprovalDate(Date committeeApprovalDate) {
        this.committeeApprovalDate = committeeApprovalDate;
    }

    public int getFreePorts() {
        return freePorts;
    }

    public void setFreePorts(int freePorts) {
        this.freePorts = freePorts;
    }

    public ConnectionAreaStatusValue getConnectionAreaStatusValue() {
        return connectionAreaStatusValue;
    }

    public void setConnectionAreaStatusValue(ConnectionAreaStatusValue connectionAreaStatusValue) {
        this.connectionAreaStatusValue = connectionAreaStatusValue;
    }

    public PackageLevelStatusValue getPackageLevelStatusValue() {
        return packageLevelStatusValue;
    }

    public void setPackageLevelStatusValue(PackageLevelStatusValue packageLevelStatusValue) {
        this.packageLevelStatusValue = packageLevelStatusValue;
    }

    public List<Line> getLines() {
        return lines;
    }

    public void setLines(List<Line> lines) {
        this.lines = lines;
    }

    public KontesRegion getKontesRegion() {
        return kontesRegion;
    }

    public void setKontesRegion(KontesRegion kontesRegion) {
        this.kontesRegion = kontesRegion;
    }
}
